from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional, Any
from module_admin.annotation.pydantic_annotation import as_query
from decimal import Decimal

class MachineModel(BaseModel):
    """
    机台表对应pydantic模型
    """

    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='ID')
    machine_id: Optional[int] = Field(default=None, description='机台号')
    machine_name: Optional[str] = Field(default=None, description='机台名称')
    CREDITS: Optional[Decimal] = Field(alias='CREDITS', default=None, description='真钱数')
    SCORE: Optional[Decimal] = Field(alias='SCORE', default=None, description='余额')
    Probability: Optional[str] = Field(alias='Probability', default=None, description='概率设置:92=92,93=93,94=94,95=95,96=96,97=97,98=98,99=99')
    tbIndex: Optional[str] = Field(alias='tbIndex', default=None, description='投币比例:0=0.1f,1=0.5f,2=1,3=2,4=5,5=10,6=50,7=100,8=200,9=500,10=1000,11=5000,12=10000')
    cpIndex: Optional[str] = Field(alias='cpIndex', default=None, description='彩票比例:0=1,1=2,2=5,3=10,4=50,5=100,6=200,7=500,8=1000,9=5000,10=10000')
    kfIndex: Optional[str] = Field(alias='kfIndex', default=None, description='开分比例:0=1,1=2,2=5,3=10,4=50,5=100,6=200,7=500,8=1000,9=5000,10=10000')
    xfIndex: Optional[str] = Field(alias='xfIndex', default=None, description='洗分比例:0=1,1=2,2=5,3=10,4=50,5=100,6=200,7=500,8=1000,9=5000,10=10000')
    jcIndex: Optional[str] = Field(alias='jcIndex', default=None, description='进钞比例:0=1,1=2,2=5,3=10,4=50,5=100,6=200,7=500,8=1000,9=5000,10=10000')
    mbIndex: Optional[str] = Field(alias='mbIndex', default=None, description='码表比例:0=1,1=2,2=5,3=10,4=50,5=100,6=200,7=500,8=1000,9=5000,10=10000')
    jfsxIndex: Optional[str] = Field(alias='jfsxIndex', default=None, description='进分上限:0=5000,1=10000,2=100000,3=200000,4=500000,5=1000000,6=2000000,7=5000000,8=10000000,9=20000000,10=50000000,11=100000000,12=200000000,13=500000000,14=1000000000')
    xtptIndex: Optional[str] = Field(alias='xtptIndex', default=None, description='系统破台:0=5000,1=10000,2=100000,3=200000,4=500000,5=1000000,6=2000000,7=5000000,8=10000000,9=20000000,10=50000000,11=100000000,12=200000000,13=500000000,14=1000000000')
    OutChao: Optional[int] = Field(alias='OutChao', default=None, description='进钞:0=有,1=无')
    OutSilver: Optional[str] = Field(alias='OutSilver', default=None, description='出银模式:0=退币,1=退彩票')
    SiteType: Optional[str] = Field(alias='SiteType', default=None, description='场地模式:0=小,1=中,2=大')
    MachineType: Optional[str] = Field(alias='MachineType', default=None, description='是否连线:1=是连接,0=单机')
    SaleType: Optional[int] = Field(alias='SaleType', default=None, description='销售模式(0买断  1~60合作天数)')
    MinBetId: Optional[str] = Field(alias='MinBetId', default=None, description='最低押注:0=45,1=60,2=75,3=105,4=150')
    status: Optional[int] = Field(default=None, description='状态:0=禁用,1=启用')
    is_ws_online: Optional[int] = Field(default=None, description='在线状态:0=离线,1=在线')
    remark: Optional[str] = Field(default='', description='备注')
    create_time: Optional[int] = Field(alias='create_time', default=None, description='创建时间')
    update_time: Optional[int] = Field(alias='update_time', default=None, description='修改时间')
    BillMachine1: Optional[Any] = Field(alias='BillMachine1', default=None, description='json')
    BillMachine2: Optional[Any] = Field(alias='BillMachine2', default=None, description='json') 

class MachineQueryModel(MachineModel):
    """
    机台管理不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class MachinePageQueryModel(MachineQueryModel):
    """
    机台管理分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')

class DeleteMachineModel(BaseModel):
    """
    删除字典类型模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    dict_ids: str = Field(description='需要删除的主键')